package com.neusoft.grid.entity;

import java.io.*;
import java.util.HashMap;
import java.util.Map;

public class MissionBuilder {
    public static void main(String[] args) throws FileNotFoundException, IOException {
        File file = new File("src/com/neusoft/grid/data/mission.txt");
        try {
            if (!file.exists() || file.length() == 0) {
                System.out.println("Data file missing or empty");
                file.createNewFile();
            }
            FileOutputStream fos = new FileOutputStream(file);
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            Map<String,Mission> missionMap = new HashMap<>();
            missionMap.put("1",new Mission("张三","13800138000","辽宁省 沈阳市","大东区岩泉路456号",
                    "四级","空气混沌","2025","6","15","1"));

            missionMap.put("2",new Mission("李四","13900139000","辽宁省 大连市","河东区南二路孝义里1-232-6号",
                    "二级","呼吸不畅","2025","6","16","2"));    
            missionMap.put("3",new Mission("王五","13700137000","辽宁省 沈阳市","井陉矿区正定街西五路",
                    "一级","无","2025","6","17","3"));
            System.out.println(missionMap.size());
            oos.writeObject(missionMap);
            oos.close();
        } catch (IOException e) {
            System.err.println("Error loading data or FXML");
            e.printStackTrace();
        }
    }
}
